<?php 

require("../include/config.php");
require("../API/php/fonctions.php");
require("../API/php/header.php");

$colonn = "";
$value = "";

if(isset($_POST)) {
	foreach($_POST as $key=>$val) {
		if(strlen($colonn)>0){
			$limiter = ",";
		}else{
			$limiter = "";
		}
		$colonn .= $limiter."`".$key."`";
		$value .= $limiter."'".addslashes($val)."'";
	 }
}

// CONNECION SQL
$db = mysql_connect($host, $base, $mdp)  or die('Erreur de connexion '.mysql_error());
mysql_query("SET NAMES UTF8"); 

// CONNECION BASE
mysql_select_db($base,$db)  or die('Erreur de selection '.mysql_error()); 

$sql = "INSERT INTO `rec_ticket` (".$colonn.") VALUES (".$value.")";
mysql_query($sql) or die('Erreur SQL !'.$sql.'<br>'.mysql_error()); 

// DECONNECION SQL
mysql_close();

?>